import React from "react";

const mapping = {
    0:' ',
    1:'X',
    2:'O'
}

class Block extends React.Component {
    constructor(props) {
        super(props);
        // this.props.isClickable
        // this.props.state
        // this.props.position
        // this.props.toFather
        this.clickHandler = this.clickHandler.bind(this);
    }
    clickHandler() {
        if (this.props.isClickable) {
            this.props.toFather(this.props.position)
        } else {
        }
    }
    render() {
        return (
            <div className="Block" onClick={this.clickHandler}>{mapping[this.props.state]}</div>
        )
    }
}

export default Block;